package com.taotao.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.taotao.common.EasyUIDataGridResult;
import com.taotao.common.TaotaoResult;
import com.taotao.pojo.TbItem;
import com.taotao.service.ItemService;

@Controller
public class ItemController {
	
	@Autowired
	private ItemService itemService;
	
	/**
	 * 分页显示所有商品
	 */
	@RequestMapping("/item/list")
	@ResponseBody
	public EasyUIDataGridResult showItemList(int page, int rows) {
		
		return itemService.getItemList(page, rows);
	}
	
	/**
	 * 上传商品
	 */
	@RequestMapping("/item/save")
	@ResponseBody
	public TaotaoResult addItem(TbItem item, String desc) {
	
		return itemService.addItem(item, desc);
	}

}
